
export function isExternal(path) {
  return /^(https?:|mailto:|tel:)/.test(path)
}

export function validUsername(str) {
  // 用户名正则，4到16位（字母，数字，下划线，减号）
  let regex = /^[a-zA-Z0-9_-]{4,16}$/;
  return regex.test(str)
}

export function validPassword(str) {
  // let regex =  /^.*(?=.{6,8})(?=.*\d)(?=.*[A-Z])(?=.*[a-z])(?=.*[!@\.#$%^&*? ]).*$/
  let regex =  /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])[a-zA-Z0-9]{6,8}$/
  return regex.test(str)
}

export function isEmpty(data) {
  return data === undefined || data == null || data.length === 0 || data === ''
}

export function isNotEmpty(data) {
  return !isEmpty(data)
}
